package com.nbsaas.boot.app.rest.convert;

import com.nbsaas.boot.app.data.entity.AppRole;
import com.nbsaas.boot.app.api.domain.request.AppRoleRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.app.data.entity.App;

/**
* 角色请求对象转换成实体对象
*/

public class AppRoleEntityConvert  implements Converter<AppRole, AppRoleRequest> {

    @Override
    public AppRole convert(AppRoleRequest source) {
        AppRole result = new AppRole();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getApp()!=null){
                    App app =new App();
                    app.setId(source.getApp());
                    result.setApp(app);
                    }
        return result;
    }
}

